<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>应用管理</title>
    <link rel="stylesheet" href="<?php echo DC_STATICS;?>/libs/layui/2.13.0/css/layui.css">
    <link rel="stylesheet" href="<?php echo DC_STATICS;?>/devc/css/main.css">
</head>
<body>
    <div class="page-container">
        <div class="page-header">
            <h2 class="page-title">应用管理</h2>
        </div>
        
        <!-- 工具栏 -->
        <div class="table-toolbar">
            <div class="layui-btn-group">
                <button class="layui-btn layui-btn-sm" id="add-application"><i class="layui-icon">&#xe654;</i> 新增应用</button>
            </div>
            
            <!-- 筛选条件 -->
            <div class="layui-form layui-inline">
                <div class="layui-input-inline" style="width: 200px;">
                    <input type="text" name="search" placeholder="搜索应用名称" autocomplete="off" class="layui-input">
                </div>
                <button class="layui-btn layui-btn-primary layui-btn-sm" id="search-btn"><i class="layui-icon">&#xe615;</i> 搜索</button>
            </div>
        </div>
        
        <!-- 应用列表 -->
        <table id="application-table" lay-filter="application-table"></table>
        
        <!-- 表格操作按钮模板 -->
        <script type="text/html" id="table-operation">
            <a class="layui-btn layui-btn-sm" lay-event="edit">编辑</a>
            <a class="layui-btn layui-btn-normal layui-btn-sm" lay-event="versions">版本</a>
            <a class="layui-btn layui-btn-danger layui-btn-sm" lay-event="del">删除</a>
        </script>
        
        <!-- 版本状态模板 -->
        <script type="text/html" id="versionStatusTpl">
            {{#  if(d.versionStatus === '开发中'){ }}
            <span class="layui-badge layui-bg-orange">{{ d.versionStatus }}</span>
            {{#  } else if(d.versionStatus === '测试中'){ }}
            <span class="layui-badge layui-bg-blue">{{ d.versionStatus }}</span>
            {{#  } else if(d.versionStatus === '已发布'){ }}
            <span class="layui-badge layui-bg-green">{{ d.versionStatus }}</span>
            {{#  } else if(d.versionStatus === '已废弃'){ }}
            <span class="layui-badge layui-bg-gray">{{ d.versionStatus }}</span>
            {{#  } else { }}
            <span class="layui-badge layui-bg-gray">无版本</span>
            {{#  } }}
        </script>
    </div>
    
    <!-- 新增/编辑应用表单 -->
    <div id="application-form" style="display: none; padding: 20px;">
        <form class="layui-form" lay-filter="application-form">
            <div class="layui-form-item">
                <label class="layui-form-label">应用名称</label>
                <div class="layui-input-block">
                    <input type="text" name="app_name" required lay-verify="required" placeholder="请输入应用名称" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">描述</label>
                <div class="layui-input-block">
                    <textarea name="app_desc" placeholder="请输入应用描述" class="layui-textarea"></textarea>
                </div>
            </div>
            <div class="layui-form-item" style="display: none;">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="save-application">保存</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
            <input type="hidden" name="id">
        </form>
    </div>
    <script src="<?php echo DC_STATICS;?>/libs/layui/2.13.0/layui.js"></script>
    <script src="<?php echo DC_STATICS;?>/devc/js/applications.js?v=0.0"></script>
    <script>
    layui.use(['table', 'form', 'layer', 'applications'], function(){
        var applications = layui.applications;
        applications.init();
    });
    </script>
</body>
</html>